package com.chorye.basictransactional.controller;

import com.chorye.basictransactional.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Chorye
 * @since 2019-06-14
 */
@RestController
@RequestMapping("/student")
public class StudentController {

    /**
     * 服务层注入
     */
    @Autowired
    public StudentService studentService;

    /**
     * PROPAGATION_REQUIRED（1）
     */
    @PostMapping("/propagationOne")
    public void propagationOne() {
        studentService.propagationOneMethodA();
    }

    /**
     * PROPAGATION_REQUIRED（2）
     */
    @PostMapping("/propagationOne2")
    public void propagationOne2() {
        studentService.propagationOneMethodB2();
    }

    /**
     * PROPAGATION_SUPPORTS（1）
     */
    @PostMapping("/propagationTwo")
    public void propagationTwo() {
        studentService.propagationTwoMethodA();
    }

    /**
     * PROPAGATION_SUPPORTS（2）
     */
    @PostMapping("/propagationTwo2")
    public void propagationTwo2() {
        studentService.propagationTwoMethodB2();
    }

    /**
     * PROPAGATION_MANDATORY（1）
     */
    @PostMapping("/propagationThree")
    public void propagationThree() {
        studentService.propagationThreeMethodA();
    }

    /**
     * PROPAGATION_MANDATORY（2）
     */
    @PostMapping("/propagationThree2")
    public void propagationThree2() {
        studentService.propagationThreeMethodB2();
    }

    /**
     * PROPAGATION_REQUIRES_NEW（1）
     */
    @PostMapping("/propagationFour")
    public void propagationFour() {
        studentService.propagationFourMethodA();
    }

    /**
     * PROPAGATION_REQUIRES_NEW（2）
     */
    @PostMapping("/propagationFour2")
    public void propagationFour2() {
        studentService.propagationFourMethodB2();
    }

    /**
     * PROPAGATION_NOT_SUPPORTED（1）
     */
    @PostMapping("/propagationFive")
    public void propagationFive() {
        studentService.propagationFiveMethodA();
    }

    /**
     * PROPAGATION_NOT_SUPPORTED（2）
     */
    @PostMapping("/propagationFive2")
    public void propagationFive2() {
        studentService.propagationFiveMethodB2();
    }

    /**
     * PROPAGATION_NEVER（1）
     */
    @PostMapping("/propagationSix")
    public void propagationSix() {
        studentService.propagationSixMethodA();
    }

    /**
     * PROPAGATION_NEVER（2）
     */
    @PostMapping("/propagationSix2")
    public void propagationSix2() {
        studentService.propagationSixMethodB();
    }

    /**
     * PROPAGATION_NESTED（1）
     */
    @PostMapping("/propagationSeven")
    public void propagationSeven() {
        studentService.propagationSevenMethodA();
    }

    /**
     * PROPAGATION_NESTED（2）
     */
    @PostMapping("/propagationSeven2")
    public void propagationSeven2() {
        studentService.propagationSevenMethodA2();
    }

    /**
     * PROPAGATION_NESTED（3）
     */
    @PostMapping("/propagationSeven3")
    public void propagationSeven3() {
        studentService.propagationSevenMethodB3();
    }

}